<?php $this; /* @var $this \Comm\View */  ?>
<?php $this->_block('content'); ?>

<?php if(!empty($themes)) : ?>
<div id="theme-container" class="row">
	<?php foreach($themes as $value) : ?>
	<div class="col-sm-6 col-md-4" node-type="theme-node" data-theme-id="<?= $value['id'] ?>">
		<div class="thumbnail">
			<img src="<?= $value['pic'] ? $value['pic'] : $this->path('static/img/basic/empty.jpg') ?>" alt="" />
			<div class="caption">
				<h3 class="text-center"><?= $value['name'] ?></h3>
				<p class="text-center">
					<?php if($use_theme_id != $value['id']) : ?>
					<a href="javascript:void(0)" action-type="use" class="btn btn-info" role="button"><?= _('使用'); ?></a>
					<?php endif; ?>
					<a href="javascript:void(0)" action-type="copy" class="btn btn-info" role="button" data-toggle="modal" data-target="#modal-theme-copy"><?= _('复制'); ?></a>
					<?php if($value['user_id']) : ?>
					<a href="<?= $this->path("manage/theme/edit?id={$value['id']}") ?>" action-type="edit" class="btn btn-info" role="button"><?= _('编辑'); ?></a>
					<a href="javascript:void(0)" action-type="destroy" class="btn btn-danger" role="button"><?= _('删除'); ?></a>
					<?php endif; ?>
				</p>
			</div>
		</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="modal fade" id="modal-theme-copy" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <form id="form-theme-copy" method="post" action="<?= $this->path('aj/manage/theme/copy') ?>" onsubmit="return false">
    <input type="hidden" name="alias_id" value="" />
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title" id="exampleModalLabel"><?= _('复制模板') ?></h4>
			</div>
			<div class="modal-body">
				<div class="form-group">
					<label for="recipient-name" class="control-label"><?= _('新模板名称') ?>:</label> <input type="text" class="form-control" name="name" />
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal"><?= _('关闭') ?></button>
				<button type="submit" class="btn btn-primary"><?= _('复制') ?></button>
			</div>
		</div>
	</div>
	</form>
</div>
<?php endif; ?>

<?php $this->_blockEnd(); ?>
<?php $this->_block('body_end')?>
<?php $this->js('manage/theme/index.js'); ?>
<?php $this->_blockEnd()?>
<?php $this->_blockLoad('_block/manage', ['nav'=>'theme']) ?>